<% title @forum.title %>

<% crumb "Home", index_url %>
<% crumb @forum.title, forum_url(@forum), :class => 'active' %>

<div class="wrapper">

  <h2><span class="feed-link"><%= link_to image_tag('/images/rss.png'), formatted_forum_url(@forum, 'xml') %></span> Categories</h2>
  
  <% if admin? %>
    <div class="orange-link">
      <p><%= link_to_function "Add category", "Opinion.addElement('category')" %></p>
    </div>

    <div id="add-category" style="display:none; overflow:hidden">
      <%= form_remote_tag :url => categories_url(:forum_id => @forum.id) %>   
      <dl>
        <dt>
          <label for="category-title-input">Category name</label>
        </dt>
        <dd><input name="category[title]" id="category-title-input" type="text" size="40"/></dd>
        <dt>
          <label for="category-subtitle">Subtitle</label>
        </dt>
        <dd><input name="category[subtitle]" id="category-subtitle" type="text" size="40"/></dd>
        <dt>
          <label for="category-access-level">Minimum required access level</label>
          
        </dt>
        <dd><input name="category[access_level]" id="category-access-level" type="text" value="0" size="4"/>
          <span class="hint">usually 0 (anyone)</span>          
        </dd>

      </dl>
      <input name="submit" type="submit" value="Add" /> or <%= link_to_function 'Cancel', "Opinion.cancelAddElement('category')" %>
      </form>
    </div>
  <% end %>


  <%= render :partial => '/categories/categories_table', :object => @categories %>


<div id="page-nav" class='clear'>
  <%= pagination_links(@category_pages) if @category_pages.length > 1 %>
</div>


  <h3>Recent Activity in <em><%= @forum.title %></em></h3>

  <% if @recent_posts.empty? %>
    <p>There was no recent activity&hellip;</p>
  <% else %>
    <%= render :partial => '/posts/recent_activity', :object => @recent_posts %>
  <% end %>

</div>